<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 页面加载完成，包含dom元素，图片css等
        // window.onload = function (){
        // document.querySelector('div').addEventListener('click',function(e){
        //     e.stopPropagation()
        //     alert(111)
        // },false)
        // }

        // window.addEventListener('load', function () {
        //     alert(111)
        // })

        // dom加载完 但是图片 css没加载完
        document.addEventListener('DOMContentLoaded', function () {
            document.querySelector('div').addEventListener('click', function (e) {
                e.stopPropagation()
                alert(111)
            })
            })
            
    </script>
    <div>click me</div>
</body>

</html>